package com.zjbd.douyangsearch.es;


import lombok.Data;
import org.dromara.easyes.annotation.IndexField;
import org.dromara.easyes.annotation.IndexId;
import org.dromara.easyes.annotation.IndexName;
import org.dromara.easyes.annotation.rely.Analyzer;
import org.dromara.easyes.annotation.rely.FieldType;
import org.dromara.easyes.annotation.rely.IdType;

/**
 * 商品搜索索引
 */
@Data
//索引名 索引 = 数据库
//字段 = 文档 = 一条数据
@IndexName("hxz_goods_index")
public class GoodsEs {
    // ES主键id应该用IdType.CUSTOMIZE 用户自定义id
    @IndexId(type = IdType.CUSTOMIZE)
    private Long id;

    //商品名 要分词
    @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_MAX_WORD)
    private String goodsName;

    //添加时间
    @IndexField(fieldType = FieldType.DATE, dateFormat = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis")
    private String time;

    //价格
    @IndexField
    private Double price;

}
